<template>
	<view class="wrap">
		<u-navbar :title="$t('wdtd')" title-width="340" :border-bottom="false" back-icon-color="#fff" title-color="#fff" :background="{ backgroundColor: '#0030A8' }">
			<view class="navbar_right" slot="right" @tap="toPay()"><u-icon name="jilu" color="#fff" size="46" custom-prefix="custom-icon"></u-icon></view>
		</u-navbar>
		<view class="tom-container">
			<view class="card">
				<view class="card-item">
					<view class="card-item-value" style="color: #FF6666;">{{pageData.teamIncome}}</view>
					<view class="card-item-label">{{$t('tdzyl')}}</view>
				</view>
				<view class="card-item">
					<view class="card-item-value">{{pageData.shareNum}}</view>
					<view class="card-item-label">{{$t('ztrs')}}</view>
				</view>
				<view class="card-item">
					<view class="card-item-value" style="color: #FF6666;">{{pageData.teamAward}}</view>
					<view class="card-item-label">{{$t('ljtgjl')}}</view>
				</view>
				<view class="card-item">
					<view class="card-item-value">{{pageData.teamPeople}}</view>
					<view class="card-item-label">{{$t('wtzrs')}}</view>
				</view>
			</view>
			<view class="list">
				<view class="list_title">
					<view class="item">{{$t('yhm')}}</view>
					<view class="item" style="text-align: center;">{{$t('ljtgjl')}}</view>
					<view class="item" style="text-align: right;">{{$t('ztrs')}}</view>
				</view>
				<view class="list_nr">
					<mescroll-uni  :fixed="false" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
						<view class="list_nr_li" v-for="(item,index) in list" :key="index">
							<view class="item">{{item.name}}</view>
							<view class="item" style="text-align: center; color: #FF6666;">{{item.teamAward}}</view>
							<view class="item" style="text-align: right;">{{item.directPeopleSum}}</view>
						</view>
					</mescroll-uni>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
export default {
	mixins: [MescrollMixin],
	data() {
		return {
			list:[],
			pageData:{},
		};
	},
	methods: {
		// 下拉刷新
		downCallback(){
			this.mescroll.resetUpScroll()
		},
		// 上拉加载
		upCallback(page){
			uni.showLoading({
				mask: true,
				title: this.$t('loading.title')
			});
			this.$api.userApi
				.getMyTeamData({
					page: page.num,
				})
				.then(res => {
					this.pageData = res.data;
					let list=res.data.myTeamDatas || [];
					this.mescroll.endSuccess(list.length)
					if(page.num == 1) this.list = []; //如果是第一页需手动制空列表
					this.list=this.list.concat(list); //追加新数据
					uni.hideLoading();
				}).catch(res =>{
					uni.hideLoading();
				})
		},
		toPay(){
			uni.navigateTo({
				url: '/pages/User/Myteam/PromotionAwards/PromotionAwards'
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.tom-container {
	position: relative;
	z-index: 1;
	&::before {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 200rpx;
		background-color: $text-color;
		z-index: -1;
		border-radius:$tom-block-radius ;
	}
}
.card {
	margin: $nr-padd;
	background: #fff;
	border-radius: 20rpx;
	display: flex;
	flex-wrap: wrap;
	padding: 30rpx;
	color: $tom-text-color;

	&-item {
		width: 50%;
		display: flex;
		flex-direction: column;
		justify-content: center;
		&:nth-child(2n) {
			align-items: flex-end;
		}
		&:nth-child(3),
		&:nth-child(4) {
			margin-top: 35rpx;
		}
		&-value {
			font-size: 28rpx;
			font-weight: bold;
		}
		&-label {
			margin-top: 14rpx;
			font-size: 28rpx;
			font-weight: bold;
			opacity: 0.8;
		}
	}
}
.list{
	background-color: #fff;
	flex: 1;
	display: flex;
	flex-direction: column;
	border-radius: 50rpx 50rpx 0rpx 0rpx;
	overflow: hidden;
	.list_title{
		color:$tom-text-color;
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 80rpx;
		padding:0rpx $nr-padd;
		
		border-bottom:2rpx solid $page-bg;
		.item{
			font-size: 28rpx;
			font-weight: bold;
			width: 100%;
		}
	}
	.list_nr{
		flex: 1;
		overflow: auto;
		background-image: url('/static/new_images/showPopup.png');
		background-position: left bottom;
		background-repeat: no-repeat;
		background-size: 100% 800rpx;
		.list_nr_li{
			color:$tom-text-color;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding:24rpx $nr-padd;
			border-bottom:2rpx solid $page-bg;
			.item{
				font-size: 24rpx;
				width: 100%;
			}
		}
	}
}
</style>
